package com.liuzhilong.infrastructure.basic.factory.statics.factory.types;

import com.liuzhilong.infrastructure.basic.factory.statics.factory.Product;

/**
 * 一个方法，通过参数来区分
 * @longandai@163.com
 */
public class TypeFactory {
    public static final Product getProduct(Type type){
        Product product = null;
        if(type==Type.PRODUCT1){
            product=   new TypeProduct1();
            //do create product1
        }
        if(type==Type.PRODUCT2){
            product=   new TypeProduct2();
            //do create product2
        }
        //do something
        return product;
    }
    public  enum Type{
        PRODUCT1,
        PRODUCT2
    }
}
